#include <iostream>
#include <cstring>

using namespace std;

char* mystrcat(char *des, const char *src)
{
    memcpy(des+strlen(des), src, strlen(src)+1);
    return des;
}

char* mystrncat(char *des, const char *src, const size_t n)
{
    size_t len = strlen(des);
    memcpy(des+len, src, n);
    *(des+len+n) = 0;
    return des;
}

int main(void)
{
    char str[31] = "Chicken";
    /* test mystrcat */
    // memset(str, 0, sizeof(str));
    // mystrcat(str, ",beautiful!");
    /* test mystrncat */
    mystrncat(str, ",beautiful!", 3);
    cout << str << endl;
    return 0;
}
